# Maintainer: Alexey Pavlov <alexpux@gmail.com>
_rnbase=opencl
_realname=${_rnbase}-headers
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
_clmajor=2
_clminor=1
_clbasever=${_clmajor}${_clminor}
pkgver=${_clmajor}.${_clminor}.0
pkgrel=1
_opencl_head_name="OpenCL-Headers"
_opencl_clhpp_name="OpenCL-CLHPP"
_opencl_clhpp_ver=2.0.9
pkgdesc="OpenCL (Open Computing Language) header files (mingw-w64)"
arch=('any')
url="http://www.khronos.org/registry/cl/"
license=("custom")
makedepends=("${MINGW_PACKAGE_PREFIX}-python2")
options=('staticlibs' 'strip')
source=("https://github.com/KhronosGroup/${_opencl_head_name}/archive/${_rnbase}${_clbasever}.zip"
        'LICENSE.txt'
        "https://github.com/KhronosGroup/${_opencl_clhpp_name}/archive/v${_opencl_clhpp_ver}.tar.gz")
sha256sums=('5c6c4b273a3e9c25094fa50702a1f84b25e63e2a9fbe74518bf9d1282c045f0a'
            'd1059405dce021e0c0a7f7e01b48447e641477e0c14a9bc29983f4202b67c410'
            'ba8ac4977650d833804f208a1b0c198006c65c5eac7c83b25dc32cea6199f58c')


package() {
   cd "${srcdir}/${_opencl_head_name}-${_rnbase}${_clbasever}"

   install -dm755 "${pkgdir}${MINGW_PREFIX}"/include/CL

   for h in $(ls -1 *.h); do
      install -m 644 ${h} "${pkgdir}${MINGW_PREFIX}"/include/CL/
   done

   install -D -m644 ../LICENSE.txt "${pkgdir}${MINGW_PREFIX}"/share/licenses/${_realname}/LICENSE
   cd "${srcdir}/${_opencl_clhpp_name}-${_opencl_clhpp_ver}"
# A CMakeLists.txt file is provided but we don't have all of the prerequisits.  Use commands based on scripts.
   ${MINGW_PREFIX}/bin/python2 ./gen_cl_hpp.py -i "./input_cl.hpp" -o "${pkgdir}${MINGW_PREFIX}"/include/CL/cl.hpp
   cp ./input_cl2.hpp "${pkgdir}${MINGW_PREFIX}"/include/CL/cl2.hpp
 }
